package com.itheima.servlet;

import com.itheima.dao.Studentdao;
import com.itheima.dao.StudentdaoImpl;
import com.itheima.domain.Student;

import java.util.List;

public class StudentServletImpl implements StudentServlet{
    private Studentdao studentDao = new StudentdaoImpl();

    @Override
    public boolean add(Student student) {
        if(studentDao.add(student)==1){
            return true;
        }
        return false;
    }

    @Override
    public boolean update(Student student) {
        if (studentDao.update(student) == 1) {
            return true;
        }
        return false;
    }


    @Override
    public Student findByid(int id) {
        return studentDao.findById(id);
    }

    @Override
    public boolean deleteById(int id) {
        if(studentDao.deleteById(id)==1){
            return true;
        }
        return false;
    }



    @Override
    public List<Student> findAll() {
        return studentDao.findAll();
    }
}
